package chapter2;

import static org.junit.Assert.*;

import java.io.File;

import org.apache.commons.io.FileUtils;
import org.junit.Test;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class TestScreenshots {

	@Test
	public void testTakesScreenshot()
	{
		WebDriver driver = new FirefoxDriver();
		driver.get("http://westpac.com.au");
	try {
	File scrFile =
	((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
	FileUtils.copyFile(scrFile, new
	File("C:\\Users\\Alice\\Downloads\\westpac_home_page.png"));
	} catch (Exception e) {
	e.printStackTrace();
	}
	driver.quit();
	}

}
